$(document).ready(function () {
    $.ajax({
        type: "GET",
        data: {offset: 0, length: 10},
        url: "./rest/shop/orderlist",
        success: function (data) {
            if (data.status != 0) {
                alert("获取失败");
                return;
            }

            var render = _.template($("#tmpl").html());
            var str = "";
            _.each(data.data, function (d) {
                d.ordertime = new Date(d.ordertime).format("yyyy-MM-dd hh:mm");
                if (d.status == 0)
                    d.status = "已下单";
                else if (d.status == 1)
                    d.status = "已确认";
                else if (d.status == 2)
                    d.status = "已评价";
                str += render(d);
            });
            $("ul").html(str);
        }
    });
});
